package org.jvm.instruction.constants;

import org.jvm.instruction.base.*;
import org.jvm.rtda.thread.Frame;

/**
 * 读取一个byte的操作数转换为int，压入操作数栈
 *
 * @author 海燕
 * @date 2023/1/14
 */
public class BIPUSH implements Instruction {

    private int val;

    @Override
    public void fetchOperands(ByteCodeReader reader) {
        this.val = reader.readInt8();
    }

    @Override
    public void execute(Frame frame) {
        frame.getOperandStack().pushInt(this.val);
    }
}
